<?php
//getQuery.php
$link = mysql_connect("localhost","root","") or die(mysql_error());
$db = mysql_selectdb("tools_gantt") or die(mysql_error());

$table = $_GET['q'];
$s_qry = "";
switch($table){
  case 'eddy_gantt':
    $qry_arr = array();
    $qry = "SELECT id, wbs_name, wbs_days, wbs_position, wbs_progress, wbs_order, project_id FROM eddy_gantt";
    $rs = mysql_query($qry) or die(mysql_error());
    if(mysql_num_rows($rs) > 0) {
      $s_qry .= "";
      while($row = mysql_fetch_array($rs)){
        $qry_arr[] = "INSERT INTO eddy_gantt (id, wbs_name, wbs_days, wbs_position, wbs_progress, wbs_order, project_id) VALUES ('".str_replace("'","''",$row['id'])."','".str_replace("'","''",$row['wbs_name'])."','".str_replace("'","''",$row['wbs_days'])."','".str_replace("'","''",$row['wbs_position'])."','".str_replace("'","''",$row['wbs_progress'])."','".str_replace("'","''",$row['wbs_order'])."','".str_replace("'","''",$row['project_id'])."'
        )";
      }
      $qry_ins = implode('~*~', $qry_arr);
      $s_qry .= $qry_ins;
    }
    break;
}

print $s_qry;